﻿CREATE PROCEDURE [dbo].[Text_GetItemsForSearchIndex]
AS
BEGIN
	SELECT [BookId]
				,[Author]
				,[CoverUrl]
	FROM [dbo].[text_Book]

	SELECT [ChapterId]
				,[ParentChapterId]
				,[BookId]
				,[HashTag]
				,[IsPublished]
				,[Order]
				,[Title]
	FROM [dbo].[text_Chapter]
	WHERE [IsPublished] = 1

	SELECT [TextId]
				,[ChapterId]
				,[Value]
				,[Order]
				,[Tag]
				,[IsPublic]
	FROM [dbo].[text_Text]
	WHERE [ChapterId] IN (SELECT DISTINCT [ChapterId] FROM [dbo].[text_Chapter] WHERE [IsPublished] = 1)
END